var userOperation = {
    telReg:/^1[34578]\d{9}$/,
    couldLogin:true,
    couldRegister:true,
    couldCount:true,
    loginCheck:function(telId,pswId,loginMsg){
        var _tel = $(telId).val();
        var _psw = $(pswId).val();
        var _msg = $(loginMsg)
        if(_tel == ""){
            _msg.show()
            _msg.text("手机号不能为空");
            this.couldLogin = false;
        }else if(!this.telReg.test(_tel)){
            _msg.show()
            _msg.text("请输入正确手机号")
            this.couldLogin = false;
        }else if(_psw == ""){
            _msg.show()
            _msg.text("请输入密码")
            this.couldLogin = false;
        }else{
            _msg.hide()
            this.couldLogin = true;
            console.log("success")
        }
    },
    registerCheck:function(telId,pswId,telCodeId,registerMsg){
        var _tel = $(telId).val();
        var _psw = $(pswId).val();
        var _telCode = $(telCodeId).val();
        var _msg = $(registerMsg)
        if(_tel == ""){
            _msg.show()
            _msg.text("手机号不能为空")
            this.couldRegister = false;
        }else if(!this.telReg.test(_tel)){
            _msg.show()
            _msg.text("请输入正确手机号")
            this.couldRegister = false;
        }else if(_psw == ""){
            _msg.show()
            _msg.text("请输入密码")
            this.couldRegister = false;
        }else if(_telCode == ""){
            _msg.show()
            _msg.text("请输入验证码")
            this.couldRegister = false;
        }else{
            _msg.hide()
            this.couldRegister = true;
        }
    },
    countDown:function(telId,telCode,telCountNum){//发送验证码区域id，读秒区域id（自定义，无#）
        _tel = $(telId).val();
        if(this.telReg.test(_tel)){
            this.couldCount = false;
            var _this = this;
            $(telCode).html("<span style='color:#ccc'><span id='" + telCountNum + "'>60</span>秒后可重新发送</span>")
            var countDownStart = window.setInterval(function(){
                $("#" + telCountNum + "").text($("#" + telCountNum + "").text() - 0 - 1);
                if($("#" + telCountNum + "").text()- 0 == 0){
                    window.clearInterval(countDownStart)
                    _this.couldCount = true;
                    $(telCode).html("发送验证码")
                }
            },1000)
        }

    }
}


